import os

from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker

from utils.helper import load_yaml
from utils.paths import DBConfigPath, DBPath

db_file = load_yaml(DBConfigPath)["db"]

AsyncEngine = create_async_engine("sqlite+aiosqlite:///" + os.path.join(DBPath, db_file))  # type: ignore
AsyncSession = async_sessionmaker(
    bind=AsyncEngine,
    class_=AsyncSession,
    expire_on_commit=False
)
